<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Java 集合框架深度解析</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css">
    <link rel="stylesheet" href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
            min-height: 100vh;
        }
        
        .hero-gradient {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        }
        
        .card-hover {
            transition: all 0.3s ease;
            border: 1px solid transparent;
        }
        
        .card-hover:hover {
            transform: translateY(-5px);
            box-shadow: 0 20px 40px rgba(0,0,0,0.1);
            border-color: #667eea;
        }
        
        .text-gradient {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
        }
        
        .code-style {
            background: #f3f4f6;
            padding: 2px 8px;
            border-radius: 4px;
            font-family: 'Courier New', monospace;
            color: #5b21b6;
            font-weight: 500;
        }
        
        .performance-badge {
            background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
            color: white;
            padding: 4px 12px;
            border-radius: 20px;
            font-size: 0.875rem;
            font-weight: 500;
            display: inline-block;
        }
        
        .structure-card {
            background: white;
            border-radius: 16px;
            padding: 2rem;
            box-shadow: 0 10px 30px rgba(0,0,0,0.05);
        }
        
        .mermaid {
            display: flex;
            justify-content: center;
            margin: 2rem 0;
        }
        
        .drop-cap {
            float: left;
            font-size: 4rem;
            line-height: 3rem;
            padding-right: 0.5rem;
            margin-top: 0.5rem;
            font-weight: 700;
            color: #667eea;
        }
        
        .section-divider {
            height: 2px;
            background: linear-gradient(to right, transparent, #667eea, transparent);
            margin: 3rem 0;
        }
    </style>
</head>
<body>
    <!-- Hero Section -->
    <section class="hero-gradient text-white py-20">
        <div class="container mx-auto px-6 text-center">
            <h1 class="text-5xl md:text-6xl font-bold mb-6">
                Java 集合框架
                <span class="block text-3xl md:text-4xl mt-4 font-light opacity-90">深度解析与最佳实践</span>
            </h1>
            <p class="text-xl md:text-2xl max-w-3xl mx-auto opacity-90 leading-relaxed">
                探索 List、Set 和 Map 的内部机制，掌握高效数据结构的选择艺术
            </p>
            <div class="mt-8 flex justify-center space-x-4">
                <span class="bg-white bg-opacity-20 px-4 py-2 rounded-full">
                    <i class="fas fa-clock mr-2"></i>阅读时间：8分钟
                </span>
                <span class="bg-white bg-opacity-20 px-4 py-2 rounded-full">
                    <i class="fas fa-layer-group mr-2"></i>深度：高级
                </span>
            </div>
        </div>
    </section>

    <!-- Main Content -->
    <main class="container mx-auto px-6 py-12 max-w-6xl">
        <!-- Introduction -->
        <div class="structure-card mb-12">
            <p class="text-lg leading-relaxed text-gray-700">
                <span class="drop-cap">在</span>Java 的世界里，集合框架是每个开发者必须精通的核心技术。<span class="code-style">List</span>、<span class="code-style">Set</span> 和 <span class="code-style">Map</span> 作为三大集合类型，它们各自拥有独特的特性和应用场景。本文将深入剖析这些数据结构的内部实现、性能特征以及最佳使用实践。
            </p>
        </div>

        <!-- Interactive Visualization -->
        <div class="structure-card mb-12">
            <h2 class="text-3xl font-bold mb-6 text-gradient">集合框架关系图谱</h2>
            <div class="mermaid">
                graph TD
                    A[Collection 接口] --> B[List 接口]
                    A --> C[Set 接口]
                    D[Map 接口]
                    
                    B --> E[ArrayList]
                    B --> F[LinkedList]
                    B --> G[Vector]
                    
                    C --> H[HashSet]
                    C --> I[LinkedHashSet]
                    C --> J[TreeSet]
                    
                    D --> K[HashMap]
                    D --> L[LinkedHashMap]
                    D --> M[TreeMap]
                    D --> N[Hashtable]
                    
                    style A fill:#667eea,stroke:#fff,stroke-width:2px,color:#fff
                    style D fill:#764ba2,stroke:#fff,stroke-width:2px,color:#fff
                    style B fill:#f093fb,stroke:#fff,stroke-width:2px,color:#fff
                    style C fill:#f093fb,stroke:#fff,stroke-width:2px,color:#fff
            </div>
        </div>

        <!-- List Section -->
        <section class="mb-16">
            <div class="flex items-center mb-8">
                <i class="fas fa-list text-4xl text-gradient mr-4"></i>
                <h2 class="text-4xl font-bold">List 有序集合</h2>
            </div>
            
            <p class="text-lg text-gray-700 mb-8 leading-relaxed">
                <span class="code-style">List</span> 是一个有序的集合，允许元素重复，并且可以通过索引访问元素。它就像一个动态数组，为我们提供了灵活的元素管理能力。
            </p>

            <div class="grid md:grid-cols-2 gap-8">
                <!-- ArrayList Card -->
                <div class="card-hover structure-card">
                    <div class="flex items-center mb-4">
                        <i class="fas fa-bolt text-3xl text-yellow-500 mr-3"></i>
                        <h3 class="text-2xl font-bold">ArrayList</h3>
                    </div>
                    
                    <div class="mb-4">
                        <span class="text-sm text-gray-500 uppercase tracking-wide">底层结构</span>
                        <p class="text-lg font-medium text-gray-800">动态数组</p>
                    </div>
                    
                    <div class="space-y-3 mb-6">
                        <div class="flex items-start">
                            <i class="fas fa-check-circle text-green-500 mt-1 mr-3"></i>
                            <p class="text-gray-700">提供快速的随机访问，通过索引直接定位元素</p>
                        </div>
                        <div class="flex items-start">
                            <i class="fas fa-check-circle text-green-500 mt-1 mr-3"></i>
                            <p class="text-gray-700">支持动态扩容，初始容量为10，扩容时增长50%</p>
                        </div>
                        <div class="flex items-start">
                            <i class="fas fa-exclamation-circle text-yellow-500 mt-1 mr-3"></i>
                            <p class="text-gray-700">插入和删除操作可能较慢，需要移动元素</p>
                        </div>
                    </div>
                    
                    <div class="border-t pt-4">
                        <h4 class="font-semibold mb-2 text-gray-800">性能指标</h4>
                        <div class="space-y-2">
                            <div class="flex justify-between items-center">
                                <span class="text-gray-600">查找元素</span>
                                <span class="performance-badge">O(1)</span>
                            </div>
                            <div class="flex justify-between items-center">
                                <span class="text-gray-600">插入/删除</span>
                                <span class="performance-badge">O(n)</span>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- LinkedList Card -->
                <div class="card-hover structure-card">
                    <div class="flex items-center mb-4">
                        <i class="fas fa-link text-3xl text-blue-500 mr-3"></i>
                        <h3 class="text-2xl font-bold">LinkedList</h3>
                    </div>
                    
                    <div class="mb-4">
                        <span class="text-sm text-gray-500 uppercase tracking-wide">底层结构</span>
                        <p class="text-lg font-medium text-gray-800">双向链表</p>
                    </div>
                    
                    <div class="space-y-3 mb-6">
                        <div class="flex items-start">
                            <i class="fas fa-check-circle text-green-500 mt-1 mr-3"></i>
                            <p class="text-gray-700">插入和删除操作高效，特别是在列表两端</p>
                        </div>
                        <div class="flex items-start">
                            <i class="fas fa-check-circle text-green-500 mt-1 mr-3"></i>
                            <p class="text-gray-700">实现了 Deque 接口，可作为双端队列使用</p>
                        </div>
                        <div class="flex items-start">
                            <i class="fas fa-exclamation-circle text-yellow-500 mt-1 mr-3"></i>
                            <p class="text-gray-700">访问元素需要遍历链表，随机访问性能较差</p>
                        </div>
                    </div>
                    
                    <div class="border-t pt-4">
                        <h4 class="font-semibold mb-2 text-gray-800">性能指标</h4>
                        <div class="space-y-2">
                            <div class="flex justify-between items-center">
                                <span class="text-gray-600">查找元素</span>
                                <span class="performance-badge">O(n)</span>
                            </div>
                            <div class="flex justify-between items-center">
                                <span class="text-gray-600">插入/删除</span>
                                <span class="performance-badge">O(1)</span>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>

        <div class="section-divider"></div>

        <!-- Set Section -->
        <section class="mb-16">
            <div class="flex items-center mb-8">
                <i class="fas fa-shapes text-4xl text-gradient mr-4"></i>
                <h2 class="text-4xl font-bold">Set 无重复集合</h2>
            </div>
            
            <p class="text-lg text-gray-700 mb-8 leading-relaxed">
                <span class="code-style">Set</span> 是一个不允许重复元素的集合，它确保集合中的每个元素都是唯一的。这使得 Set 成为去重和集合运算的理想选择。
            </p>

            <div class="grid md:grid-cols-3 gap-6">
                <!-- HashSet Card -->
                <div class="card-hover structure-card">
                    <div class="flex items-center mb-4">
                        <i class="fas fa-hashtag text-3xl text-purple-500 mr-3"></i>
                        <h3 class="text-xl font-bold">HashSet</h3>
                    </div>
                    
                    <div class="mb-4">
                        <span class="text-sm text-gray-500 uppercase tracking-wide">底层结构</span>
                        <p class="text-lg font-medium text-gray-800">哈希表</p>
                    </div>
                    
                    <div class="space-y-2 mb-4">
                        <p class="text-gray-700 text-sm">• 元素顺序不确定</p>
                        <p class="text-gray-700 text-sm">• 最快的查找速度</p>
                        <p class="text-gray-700 text-sm">• 允许 null 元素</p>
                    </div>
                    
                    <div class="text-center">
                        <span class="performance-badge">平均 O(1)</span>
                    </div>
                </div>

                <!-- LinkedHashSet Card -->
                <div class="card-hover structure-card">
                    <div class="flex items-center mb-4">
                        <i class="fas fa-stream text-3xl text-indigo-500 mr-3"></i>
                        <h3 class="text-xl font-bold">LinkedHashSet</h3>
                    </div>
                    
                    <div class="mb-4">
                        <span class="text-sm text-gray-500 uppercase tracking-wide">底层结构</span>
                        <p class="text-lg font-medium text-gray-800">哈希表 + 链表</p>
                    </div>
                    
                    <div class="space-y